<template>
  <div>
    <div class="playHeader">
      <p>推荐歌单</p>
    </div>
    <ul class="playUl">
      <li v-for="i in PersonalArr" :key="i.id">
        <a href="#">
          <div class="numTop">
            <img :src="i.picUrl" alt />
            <div class="num" @click="toPlayMusic(i)">
              <i class="iconfont icon-bofang1"></i>
              <span>{{i.trackCount}}万</span>
            </div>
          </div>
          <p class="playInfoText">{{i.name}}</p>
        </a>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data () {
    return {
      PersonalArr: null
    }
  },
  methods: {
    async getPersonalizedArr () {
      const { data: res } = await this.$http.get('/personalized')
      // console.log(res)
      if (res.code === 200) {
        this.PersonalArr = res.result
      }
    },
    // 播放音乐
    toPlayMusic (i) {
      console.log(i)
    }
  },
  created () {
    this.getPersonalizedArr()
  }
}
</script>

<style lang="less" scoped>
.playHeader {
  height: 30px;
  display: flex;
  align-items: center;
  font-weight: bold;
  font-size: 18px;
}
.playUl {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  // justify-content: space-between;
  li {
    padding-right: 20px;
    // width: 213px;
    height: 212px;
    padding-top: 10px;
    box-sizing: border-box;
    margin-bottom: 20px;
    .playInfoText {
      width: 133px;
      // height: 40px;
      // height: 100%;
      color: #333;
      font-size: 14px;
      font-weight: bold;
    }
    a {
      width: 100%;
      height: 100%;
      display: block;
      img {
        width: 133px;
        height: 133px;
        margin-bottom: 10px;
      }
    }
    &li:last-child {
      margin-right: 0;
    }
  }
}
.numTop {
  position: relative;
  img {
    position: relative;
  }
  .num {
    height: 20px;
    // width: 50px;
    background-color: #000;
    color: #fff;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    position: absolute;
    top: 5px;
    right: 5px;
    i {
      font-size: 12px;
    }
  }
}
</style>
